# 多进程
from multiprocessing import Process

# 方式1：实现多进程（小脚本常用）
# def func():
#     for i in range(100):
#         print("func", i)
#
# if __name__ == '__main__':
#     p = Process(target=func)
#     p.start()
#     for i in range(100):
#         print("main", i)

# 方式2：实现多线程（专业常用）
class MyProcess(Process):
    def run(self):
        for i in range(100):
            print("MyThread", i)

if __name__ == '__main__':
    p = MyProcess()
    p.start()
    for i in range(100):
        print("main", i)